#ifndef RAY_H
#define RAY_H
#include "global_object.h"
#include <float.h>
#include "Vector3.cu"
using namespace std;

class Ray
{
public:
	Vector3 origin;
	Vector3 direction;
	inline __host__ __device__  Ray(){
		origin = Vector3();
		direction = Vector3();
	}
	inline __host__ __device__  Ray(Vector3& origin, Vector3& direction){
		this->origin = origin;
		this->direction = direction;
	}

	 /**
     * Follows the Ray from it's origin to the Vector3D point that lies
     * tVal units away toward the Ray direction
     * @param tVal the distance to follow the Ray
     * @return the Vector3D point at origin + tVal * the ray's unit direction
     */
    inline __host__ __device__  Vector3 follow(float tVal) const;

    /**
     * Returns a Ray with the same origin and refractiveIndex data, but reflects the direction
     * @param normal the normal of the surface off which the Ray is reflecting
     * @return
     */
    inline __host__ __device__  Ray reflect(const Vector3& normal, const Vector3& hitPoint) const;

    /**
     * Returns a Ray with the same origin and refractiveIndex data, but refracts the direction
     * based on the current refractive index
     * @param normal the normal of the surface off which the Ray is refracting
     * @return
     */
    inline __host__ __device__  Ray refract(const Vector3& normal, const Vector3& hitPoint, float newRefractiveIndex) const;
};

#endif